package general;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import hibernate.*;


public class NotreServlet extends Action {
        private static final long serialVersionUID = 4785169243852951116L;

        
        public ActionForward execute(final ActionMapping pMapping,
                        ActionForm pForm, final HttpServletRequest pRequete,
                        final HttpServletResponse pReponse) {
               
                HttpSession session = pRequete.getSession();
                if (session == null)
                        return pMapping.findForward("error");
                		return pMapping.findForward("success");
        }
                
        public static void checkParametresPagination(HttpServletRequest request) throws NumberFormatException {
                String strDebut = (String)request.getParameter("debut");
                String strNb = (String)request.getParameter("nb");
                if (strDebut != null || strNb != null) {
                        int debut = Integer.parseInt(strDebut);
                        int nb = Integer.parseInt(strNb);
                        if (debut <= 0 || nb <= 0)
                                throw new NumberFormatException();
                }
        }
}
